{extend name="public:base" /}
{block name="body"}
	<P>首页&nbsp>&nbsp{$art.cate_id|getCateName}&nbsp>&nbsp{$art.title}</P>
	<!-- 主体 -->
	<div class="row">
		<!-- 左侧8列 -->
		<div class="col-md-8">
		<!-- 页头 -->
		<div class="page-header">
  			<h3>{$art.cate_id|getCateName}</h3>			
		</div>

		<div style="width:%60">			
            
             <h4>{$art.title}</h4>
                <p>作者:{$art.user_id|getUserName}&nbsp;&nbsp;
               发布时间:{$art.create_time}&nbsp;&nbsp;
               浏览:{$art.pv}&nbsp;&nbsp;
			   </p>
               <div >{:htmlspecialchars_decode($art.content)}</div>

			<div class="ContentItem-actions">
				<span>
				</span>
				<button type="button" id="open" class="Button ContentItem-action1 Button--plain Button--withIcon Button--withLabel">
					<span style="display: inline-flex; align-items: center;">​
						<svg class="Zi Zi--Comment Button-zi" fill="currentColor" viewBox="0 0 24 24"
						width="1.2em" height="1.2em">
							<path d="M10.241 19.313a.97.97 0 0 0-.77.2 7.908 7.908 0 0 1-3.772 1.482.409.409 0 0 1-.38-.637 5.825 5.825 0 0 0 1.11-2.237.605.605 0 0 0-.227-.59A7.935 7.935 0 0 1 3 11.25C3 6.7 7.03 3 12 3s9 3.7 9 8.25-4.373 9.108-10.759 8.063z"
							fill-rule="evenodd">
							</path>
						</svg>
					</span>
					评论
				</button>
				
				
				<div class="Popover ShareMenu ContentItem-action">
					<div class="" id="Popover6-toggle" aria-haspopup="true" aria-expanded="false"
					aria-owns="Popover6-content">
						<button type="button" class="Button Button--plain Button--withIcon Button--withLabel">
							<span style="display: inline-flex; align-items: center;">
								​
								<svg class="Zi Zi--Share Button-zi" fill="currentColor" viewBox="0 0 24 24"
								width="1.2em" height="1.2em">
									<path d="M2.931 7.89c-1.067.24-1.275 1.669-.318 2.207l5.277 2.908 8.168-4.776c.25-.127.477.198.273.39L9.05 14.66l.927 5.953c.18 1.084 1.593 1.376 2.182.456l9.644-15.242c.584-.892-.212-2.029-1.234-1.796L2.93 7.89z"
									fill-rule="evenodd">
									</path>
								</svg>
							</span>
							分享
						</button>
					</div>
				</div>
				<button type="button" id="fav" user_id="{$art.user_id}" article_id="{$art.id}" session_id="{$Think.session.user_id}" class="Button ContentItem-action Button--plain Button--withIcon Button--withLabel">
					<span style="display: inline-flex; align-items: center;">
						​
						<svg class="Zi Zi--Star Button-zi" fill="currentColor" viewBox="0 0 24 24"
						width="1.2em" height="1.2em">
							<path d="M5.515 19.64l.918-5.355-3.89-3.792c-.926-.902-.639-1.784.64-1.97L8.56 7.74l2.404-4.871c.572-1.16 1.5-1.16 2.072 0L15.44 7.74l5.377.782c1.28.186 1.566 1.068.64 1.97l-3.89 3.793.918 5.354c.219 1.274-.532 1.82-1.676 1.218L12 18.33l-4.808 2.528c-1.145.602-1.896.056-1.677-1.218z"
							fill-rule="evenodd">
							</path>
						</svg>
					</span>
					收藏
				</button>
				<button type="button" id="like" user_id="{$art.user_id}" article_id="{$art.id}" session_id="{$Think.session.user_id}" class="Button ContentItem-action Button--plain Button--withIcon Button--withLabel">
					<span style="display: inline-flex; align-items: center;">
						​
						<svg class="Zi Zi--Heart Button-zi" fill="currentColor" viewBox="0 0 24 24"
						width="1.2em" height="1.2em">
							<path d="M2 8.437C2 5.505 4.294 3.094 7.207 3 9.243 3 11.092 4.19 12 6c.823-1.758 2.649-3 4.651-3C19.545 3 22 5.507 22 8.432 22 16.24 13.842 21 12 21 10.158 21 2 16.24 2 8.437z"
							fill-rule="evenodd">
							</path>
						</svg>
					</span>
					点赞
				</button>
				</div>
			
				<!--回复作者-->
				<form style="margin-top:10px;display:none;"   method="post" id="user_comment"  >
						<input type="hidden" name="article_id" value="{$art.id}">
						<input type="hidden" name="user_id" value="{$art.user_id}">
						<input type="hidden" name="reply_id" value="{$Think.session.user_id}">
				
						  <div class="form-group">	
							<input type="text" class="form-control" id="content" value="" name="user_comment" placeholder="写下你的评论">
						  </div>
						  
						  <button type="button" id="comment" class="Button  Button--plain Button--withIcon Button--withLabel">
							<span style="display: inline-flex; align-items: center;">​
								<svg class="Zi Zi--Comment Button-zi" fill="currentColor" viewBox="0 0 24 24"
								width="1.2em" height="1.2em">
									<path d="M10.241 19.313a.97.97 0 0 0-.77.2 7.908 7.908 0 0 1-3.772 1.482.409.409 0 0 1-.38-.637 5.825 5.825 0 0 0 1.11-2.237.605.605 0 0 0-.227-.59A7.935 7.935 0 0 1 3 11.25C3 6.7 7.03 3 12 3s9 3.7 9 8.25-4.373 9.108-10.759 8.063z"
									fill-rule="evenodd">
									</path>
								</svg>
							</span>
							提交
						</button>
				</form >
				
				
				<div style="border:1px solid #DDDDDD;border-radius:5px; padding:10px 20px 0px 20px; margin:10px 0px 10px 0px;" {eq name="$art.id|getUserComment" value="0"}class="hidden"{/eq}> 
					{volist name="comment" id="vo"}
					<div ><p>{$vo.reply_id|getUserName}&nbsp回复&nbsp{$vo.user_id|getUserName}  </p></div>
					<p>{$vo.user_comment}</p>
					<p>{$vo.create_time}</p>
					<p>{$vo.id}</p>
						
				  	
					<!--回复用户-->
					<form style="margin-top:10px;" method="post" class="reply_comment" name="" >
							<div class="form-group ">
							<input type="hidden" name="id" value="{$vo.id}">
							<input type="hidden" name="article_id" value="{$vo.article_id}">
							<input type="hidden" name="user_id" value="{$vo.reply_id}">
							<input type="hidden" name="reply_id" value="{$Think.session.user_id}">
							<input type="text" class="form-control "  value="" name="reply_comment" placeholder="写下你的评论">
						  </div>
						  
						  
						  <button type="button"  class="reply Button ContentItem-action1 Button--plain Button--withIcon Button--withLabel">
							<span style="display: inline-flex; align-items: center;">​
								<svg class="Zi Zi--Comment Button-zi" fill="currentColor" viewBox="0 0 24 24"
								width="1.2em" height="1.2em">
									<path d="M10.241 19.313a.97.97 0 0 0-.77.2 7.908 7.908 0 0 1-3.772 1.482.409.409 0 0 1-.38-.637 5.825 5.825 0 0 0 1.11-2.237.605.605 0 0 0-.227-.59A7.935 7.935 0 0 1 3 11.25C3 6.7 7.03 3 12 3s9 3.7 9 8.25-4.373 9.108-10.759 8.063z"
									fill-rule="evenodd">
									</path>
								</svg>
							</span>
							发表
						  </button>			  
						  <button type="button" name="id" class="del_reply Button ContentItem-action1 Button--plain Button--withIcon Button--withLabel">
							<span style="display: inline-flex; align-items: center;">​
								<svg class="Zi Zi--Comment Button-zi" fill="currentColor" viewBox="0 0 24 24"
								width="1.2em" height="1.2em">
									<path d="M10.241 19.313a.97.97 0 0 0-.77.2 7.908 7.908 0 0 1-3.772 1.482.409.409 0 0 1-.38-.637 5.825 5.825 0 0 0 1.11-2.237.605.605 0 0 0-.227-.59A7.935 7.935 0 0 1 3 11.25C3 6.7 7.03 3 12 3s9 3.7 9 8.25-4.373 9.108-10.759 8.063z"
									fill-rule="evenodd">
									</path>
								</svg>
							</span>
							删除
						</button>
				  </form>
						  <button type="button" id="{$vo.id}" value="{$vo.id}" onclick="reply_open()" class="reply_open Button  Button--plain Button--withIcon Button--withLabel">
							<span style="display: inline-flex; align-items: center;">​
								<svg class="Zi Zi--Comment Button-zi" fill="currentColor" viewBox="0 0 24 24"
								width="1.2em" height="1.2em">
									<path d="M10.241 19.313a.97.97 0 0 0-.77.2 7.908 7.908 0 0 1-3.772 1.482.409.409 0 0 1-.38-.637 5.825 5.825 0 0 0 1.11-2.237.605.605 0 0 0-.227-.59A7.935 7.935 0 0 1 3 11.25C3 6.7 7.03 3 12 3s9 3.7 9 8.25-4.373 9.108-10.759 8.063z"
									fill-rule="evenodd">
									</path>
								</svg>
							</span>
							评论
						</button>
					<hr>
					{/volist}			  
				  </div>
				  
			</div>
				
		</div><!-- <div class="col-md-8"> -->		
				
				
				
	
         
         
          <!-- 处理收藏功能 -->
          <script type="text/javascript">
            $(function(){
              $('#fav').on('click',function(){
                //获取当前的用户id与栏目id,因为收藏表中有这二个字段
                var userId = $(this).attr('user_id')
                var artId = $(this).attr('article_id')
                var sessionId = $(this).attr('session_id')
                if (userId && artId){
                  $.ajax(
                  {
                    type: 'get',
                    url : "{:url('index/index/fav')}",
                    data: {
                            user_id    : userId,
                            article_id : artId,
                            session_id : sessionId,
                            time:new Date().getTime()
                          },
                    dataType : 'json',
                    success  : function(data)
                    {
                      switch(data.status)
                      {
                      case 1:
                        $('#fav_logo').attr('class','glyphicon glyphicon-star')
                        //$('#fav').text(data.message)
						alert(data.message)
                        break

                        case 0:
                        $('#fav_logo').attr('class','glyphicon glyphicon-star-empty')
                        //$('#fav').text(data.message)
						alert(data.message)
                        break

                        case -1:
                        alert(data.message)
                        break

                        case -2:
                        alert(data.message)
                        break

                      }
                   }
                  }
                    
                  )
                }
  
              })
            })
          </script>     
	     <!-- 处理点赞功能 -->
          <script type="text/javascript">
            $(function(){
              $('#like').on('click',function(){
                //获取当前的用户id与栏目id,因为收藏表中有这二个字段
                var userId = $(this).attr('user_id')
                var artId = $(this).attr('article_id')
                var sessionId = $(this).attr('session_id')
                if (userId && artId){
                  $.ajax(
                  {
                    type: 'get',
                    url : "{:url('index/index/like')}",
                    data: {
                            user_id    : userId,
                            article_id : artId,
                            session_id : sessionId,
                            time:new Date().getTime()
                          },
                    dataType : 'json',
                    success  : function(data)
                    {
                      switch(data.status)
                      {
						case 1:
						$('#like_logo').css('glyphicon glyphicon-heart') ;
                        
                        //$('#like').text(data.message)
						alert(data.message)
                        break

                        case 0:
                        $('#like_logo').css('glyphicon glyphicon-heart-empty') ;
						//
                        //$('#like').text(data.message)
						alert(data.message)
                        break

                        case -1:
                        alert(data.message)
                        break

                        case -2:
                        alert(data.message)
                        break

                      }
                   }
                  }
                    
                  )
                }
  
              })
            })
          </script> 
		   <!-- 处理评论功能 -->
		  <script type="text/javascript">
			  $(function(){
				$('#comment').on('click',function(){
				  //用ajax提交用户信息 
				  //alert($('#user_comment').serialize())
				  $.ajax({
					type: 'post',
					url: "{:url('index/index/comment')}",
					data: $('#user_comment').serialize(),
					dataType: 'json',
					success: function(data){
					  switch (data.status)
					  {
						case 1:  //评论成功
						  alert(data.message);
						 
						//$('#content').text("Hello world!");
							//$('#content').attr("value","money");
						 window.location.reload()
						  //window.location.href = "{:url('index/index/')}";
						break;
						
						 case -1:
                        alert(data.message)
                        break

                        case -2:
                        alert(data.message)
                        break
					  }

					}
				  })
			  })
			  })
		   </script>
		   <!-- 处理回复功能 -->
		  <script type="text/javascript">
			  $(function(){
				$('.reply').on('click',function(){
				//测试表单数据
				//alert($('#reply_comment').serialize())
				  //用ajax提交用户信息 
				  
				  $.ajax({
					type: 'post',
					url: "{:url('index/index/reply')}",
					data:$('.reply_comment').serialize(),
					dataType: 'json',
					success: function(data){
					  switch (data.status)
					  {
						case 1:  //评论成功
						  alert(data.message);
						 
						//$('#content').text("Hello world!");
							//$('#content').attr("value","money");
						 window.location.reload()
						  //window.location.href = "{:url('index/index/')}";
						break;
						
						 case -1:
                        alert(data.message)
                        break

                        case -2:
                        alert(data.message)
                        break
					  }

					}
				  })
			  })
			  })
		   </script>
		   <!--删除评论--->
		   <script type="text/javascript">
			  $(function(){
				$('.del_reply').on('click',function(){
				//测试表单数据
				//alert($('#reply_comment').serialize())
				  //用ajax提交用户信息 
				  
				  $.ajax({
					type: 'post',
					url: "{:url('index/index/del')}",
					data:$('.reply_comment').serialize(),
					dataType: 'json',
					success: function(data){
					  switch (data.status)
					  {
						case 1:  //评论成功
						  alert(data.message);
						 
						//$('#content').text("Hello world!");
							//$('#content').attr("value","money");
						 window.location.reload()
						  //window.location.href = "{:url('index/index/')}";
						break;
						
						case -1:
                        alert(data.message)
                        break

                        case -2:
                        alert(data.message)
                        break
					  }

					}
				  })
			  })
			  })
		   </script>
		   <!--弹出作者评论-->
		   <script type="text/javascript">
			
			$("#open").click(function(){
				if($("#user_comment").css("display")=="none"){
					$("#user_comment").show(100);
				}else{
					$("#user_comment").hide(100);
				}
			});

			
		   </script>
		   <!--动态获取按钮值-->
		   <!--弹出用户评论-->
		   

</script>


		   
		   
{/block}